package domain.extendMappingTablePerClass;


import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Entity
@Table(name = "employee_inf")
public class Employee extends Person{
    private double salary;
    @OneToMany(targetEntity = Customer.class,mappedBy = "employee")
    private Set<Customer> customers = new HashSet<>();

    @ManyToOne(targetEntity = Manager.class,cascade = CascadeType.ALL)
    @JoinColumn(name = "manager_id")
    private Manager manager;

    public Employee() {
    }

    public Employee(String name, double salary) {
        super(name);
        this.salary = salary;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public Set<Customer> getCustomers() {
        return customers;
    }

    public void setCustomers(Set<Customer> customers) {
        this.customers = customers;
    }

    public Manager getManager() {
        return manager;
    }

    public void setManager(Manager manager) {
        this.manager = manager;
    }
}
